<template>
    <div class="app-container">
        <el-form :model="leaveFormData" ref="leaveFormData"  label-width="120px">
              <el-row>
                <el-col :span="12">
                    <el-form-item label="班级" prop="classId">
                        <label>{{leaveFormData.className}}</label>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="学生" prop="studentId">
                        <label >{{leaveFormData.studentName}}</label>
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                  <el-col :span="12">
                      <el-form-item label="请假开始时间" prop="leaveStartTime">
                          <el-date-picker
                              :disabled="true"
                              style="width:60%"
                              v-model="leaveFormData.leaveStartTime"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="选择开始日期时间">
                          </el-date-picker>
                      </el-form-item>
                  </el-col>
                  <el-col :span="12">
                      <el-form-item label="请假结束时间" prop="leaveEndTime">
                          <el-date-picker
                              :disabled="true"
                              style="width:60%"
                              v-model="leaveFormData.leaveEndTime"
                              type="datetime"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="选择结束日期时间">
                          </el-date-picker>
                      </el-form-item>
                  </el-col>
                  
              </el-row>
              <el-row>
                <el-col :span="12">
                    <el-form-item label="请假总天数" prop="leaveTotalTime">
                        <el-input v-model="leaveFormData.leaveTotalTime" style="width:60%" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="请假类型" prop="leaveType">
                        <el-select v-model="leaveFormData.leaveType" style="width:60%" :disabled="true">
                            <el-option v-for="item in leaveTypeList" :key="item.id" :value="item.dictValue" :label="item.dictLabel"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
              </el-row>
              
              <el-form-item label="请假原因" prop="leaveRemarks">
                  <el-input v-model="leaveFormData.leaveRemarks" type="textarea" :disabled="true"></el-input>
              </el-form-item>
              <el-form-item label="抄送人" prop="ccUsers">
                <el-tag v-for="item in leaveFormData.ccUserList" :key="item.id" style="margin-left: 3px;">{{item.userName}}</el-tag>
              </el-form-item>
              <el-row>
                <el-col :span="12">
                    <el-form-item label="申请人" >
                        {{leaveFormData.createBy}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="申请时间" prop="leaveType">
                        {{parseTime(leaveFormData.createTime)}}
                    </el-form-item>
                </el-col>
              </el-row>
          </el-form>
    </div>
  </template>
  
  <script>
  import { treeselectAll } from "@/api/system/dept";
  
  export default {
    name: "leaveApplyDetail",
    props:{
      leaveFormData: Object,
      isShowLeave: Boolean
    },
    data() {
      return {
          leaveTypeList:[],
          props:{multiple: true},
          deptOptions:[]
      };
    },
  
    created() {
      this.getDicts("leave_type").then(response => {
        this.leaveTypeList = response.data;
      });
      this.getTreeselect()
      
    },
    methods: {
      handlePreview(file){
          this.preFile(file.url)
      },
      preFile(fileName){
        window.open(process.env.VUE_APP_BASE_API + "/school/file/" +fileName)
      },
      getTreeselect() {
          treeselectAll().then(response => {
              this.deptOptions = response.data;
          });
      },
      
    }
  };
  </script>
  